module.exports = (sequelize, Sequelize) => {
	const order = sequelize.define(
		'order_info',
		{
			ordNo: { type: Sequelize.STRING(50), primaryKey: true },
			ordDate: { type: Sequelize.DATE(6), allowNull: false }, //这里不确定是否用date
			medName: {
				type: Sequelize.STRING(30),
				allowNull: false,
				references: {
					model: 'medicine',
					key: 'medName',
				},
			},
			pharmacyPlace: { type: Sequelize.STRING(100) },
			userPlace: { type: Sequelize.STRING(100), allowNull: false },
			userId: {
				type: Sequelize.STRING(15),
				allowNull: false,
				references: {
					model: 'accounts',
					key: 'userId',
				},
			},
			userName: { type: Sequelize.STRING(10), allowNull: false },
			ordOperatorNo: { type: Sequelize.STRING(10) },
			medPrice: { type: Sequelize.DOUBLE(10), allowNull: false },
			ordCount: { type: Sequelize.INTEGER, allowNull: false },
			ordTotalprice: { type: Sequelize.DOUBLE(10), allowNull: false },
			ordSituation: {
				type: Sequelize.TINYINT(1),
				allowNull: false,
				defaultValue: 0,
			},
			ordExpressno: { type: Sequelize.STRING(50) },
			medInfoId: {
				type: Sequelize.STRING(10),
				allowNull: false,
				references: {
					model: 'medicine',
					key: 'medInfoId',
				},
			},
		},
		{
			// 禁止 updatedAt, createdAt 自增
			timestamps: false,
			// 自定义表名
			freezeTableName: true,
		}
	)

	return order
}
